#include <iomanip>		// Needed for formatting e.g. setw()
#include <ctime>		// Needed for the time function
#include <windows.h>	// Needed for Color

//declare global variables
int board[100];
int boardSize = 6;		//Number of Squares per side Max = 9


/***************************************************
FUNCTION: Changes text color
INPUT: Color *See Chart at bottom*
OUTPUT: VOID
****************************************************/
void color(int color)
{
	HANDLE OutputH;
	OutputH = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(OutputH, color);
}


/***************************************************
FUNCTION: Display map and players
INPUT: Entity Alliance and Horde
OUTPUT: VOID
****************************************************/
void createMap(Entity Alliance, Entity Horde)
{
	int p;					//board position
	while (true)				// infinite loop
	{
		cout  << endl << endl;
		for (p = 0 ; p < (boardSize * boardSize) ; p++ )
		{
			board[p] = (p / boardSize ) * 100 +  ( p  %  boardSize);
			//spawn piece
			if ( p == Alliance.getEntityAt() )
			{
				color(12);	//RED on Black
				cout << setw(4) << "K";
			}
			else if ( p == Horde.getEntityAt() )
			{
				color(12);	//RED on Black
				cout << setw(4) << "W";
			}
			else
			{
			//color board
				if ( p % 2)
					color(14);
				else
					color(15);
				cout <<  setw(4) << board[p];
			}
			if ( ! ((p + 1 ) % boardSize ) )
				cout << endl << endl << endl;	//line spacing
		}
		color(15);
		break;
	}
}


/****************COLOR CHART********************
system("color xx");
default = system("color 07");
Color attributes are specified by TWO hex digits -- 
the first corresponds to the background;the second the foreground. 

Each digit can be any of the below values.
0 = Black 	8 = Gray
1 = Blue 	9 = Light Blue
2 = Green 	A = Light Green
3 = Aqua 	B = Light Aqua
4 = Red 	C = Light Red
5 = Purple 	D = Light Purple
6 = Yellow 	E = Light Yellow
7 = White 	F = Bright White
***********************************************/